import { FC,useEffect, useState,createContext } from 'react';
import { useNavigate } from 'react-router';
import Context1 from '../componenst/Context1'
import Context2 from '../componenst/Context2'
 
export const Context:any= createContext("");

const Index: FC<any> = (props:any): JSX.Element => {


    const [token,setToken] =useState("aaaaaaaaaa");
    const [user,setUser]=useState({name:"张三",age:20});
    const update=()=>{

        setUser({...user,name:"李四"})
    }

    useEffect(()=>{
    },[])

    return (
      <div>
        <div>
            {token}
            
        </div>
        <div>
            {user.name}
            <button onClick={()=>update()}>修改</button>
        </div>
        useContext
        <Context.Provider value={{token,user,setUser}}>
          <Context1></Context1>
          <Context2></Context2>
        </Context.Provider>
       
     
      </div>
    )
}
export default Index;